﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Itfort
{
	/// <summary>
	/// 
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public class EqualityComparerEx<T> : IEqualityComparer<T>
	{
		Func<T, T, bool> func;

		/// <summary>
		/// 
		/// </summary>
		/// <param name="func"></param>
		public EqualityComparerEx(Func<T, T, bool> func)
		{
			this.func = func;
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <returns></returns>
		public bool Equals(T x, T y)
		{
			return func(x, y);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="obj"></param>
		/// <returns></returns>
		public int GetHashCode(T obj)
		{
			return obj.GetHashCode();
		}
	}
}
